package com.ysd.lis.controller.bac;

import com.ysd.common.Result;
import com.ysd.lis.annotation.LogDetail;
import com.ysd.lis.aspect.OperationType;
import com.ysd.lis.controller.pub.BaseController;
import com.ysd.lis.entity.bac.BacSiteOfInfectionDict;
import com.ysd.lis.entity.sta.StaInfectSite;
import com.ysd.lis.request.bac.BacGermBaseDictRequest;
import com.ysd.lis.service.bac.BacSiteOfInfectionDictService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 微生物基础字典（感染部位）前端控制器
 *
 * @author LuoXS
 * @date 2024/3/26
 * version 1.0
 */
@RestController
@RequestMapping("/lis/bac/base/site-of-infection/dict")
public class BacSiteOfInfectionDictController extends BaseController {

    @Autowired
    BacSiteOfInfectionDictService bacSiteOfInfectionDictService;

    @ApiOperation("获取微生物基础字典-感染部位列表（分页）")
    @GetMapping("/page")
    public Result pageList(BacGermBaseDictRequest.BacSiteOfInfectionDictPageParam pageParam) {
        return bacSiteOfInfectionDictService.pageList(pageParam);
    }

    @ApiOperation("获取微生物基础字典-感染部位列表")
    @GetMapping("/findDictList")
    public Result findDictList(BacSiteOfInfectionDict pageParam) {
        return bacSiteOfInfectionDictService.findDictList(pageParam);
    }


    @ApiOperation("新增")
    @PostMapping("/add")
    @LogDetail(requestParam = "add", operationType = OperationType.INSERT, module = "微生物基础字典-感染部位", content = "新增感染部位", businessName = "bacBase")
    public Result add(@RequestBody BacSiteOfInfectionDict bacSiteOfInfectionDict) {
        return bacSiteOfInfectionDictService.add(bacSiteOfInfectionDict);
    }

    @ApiOperation("修改")
    @PostMapping("/update")
    @LogDetail(requestParam = "update", operationType = OperationType.UPDATE, module = "微生物基础字典-感染部位", content = "编辑感染部位", businessName = "bacBase")
    public Result update(@RequestBody BacSiteOfInfectionDict bacSiteOfInfectionDict) {
        return bacSiteOfInfectionDictService.updateDit(bacSiteOfInfectionDict);
    }

    @ApiOperation("删除")
    @PostMapping("/delete")
    @LogDetail(requestParam = "delete", operationType = OperationType.DELETE, module = "微生物基础字典-感染部位", content = "删除感染部位", businessName = "bacBase")
    public Result delete(@RequestBody BacGermBaseDictRequest.BacSiteOfInfectionDictDeleteParam deleteParam) {
        return bacSiteOfInfectionDictService.delete(deleteParam);
    }


    @ApiOperation("标准库创建")
    @PostMapping("/staDataSiteOfInfectionDict")
    public Result staDataSiteOfInfectionDict(@RequestBody List<StaInfectSite> staInfectSites) {
        return bacSiteOfInfectionDictService.staDataSiteOfInfectionDict(staInfectSites);
    }

}
